# -*- bazel -*-

load("@drake//tools/skylark:py.bzl", "py_binary")
load("@drake//tools/workspace:generate_file.bzl", "generate_file")

licenses(["notice"])  # BSD-3-Clause

generate_file(
    name = "ros_xacro_main.py",
    # This is the same as scripts/xacro from upstream, except that we lose the
    # unused shebang line and we use a filename that is not subject to import
    # path conflicts.
    content = "import xacro; xacro.main()",
)

py_binary(
    name = "xacro_bin",
    main = "ros_xacro_main.py",
    srcs = ["ros_xacro_main.py"] + glob([
        "xacro/**/*.py",
    ], allow_empty = False),
    imports = ["."],
    python_version = "PY3",
    srcs_version = "PY3",
)

alias(
    name = "xacro",
    actual = ":xacro_bin",
    visibility = ["//visibility:public"],
)

exports_files(["drake_repository_metadata.json"])
